<template>
  <div class="h100">
    <MkDragSplitPanel style="height: 100%;" leftWidth="350px">
      <template #left>
        <MKShenQingDanList ref="listShenQingRef" @dblclick="listDblclick" />
      </template>
      <template #right>
        <el-tabs v-model="tabActivieName" type="border-card" style="flex: 1; overflow: auto;" @tab-click="tabChange">
          <el-tab-pane label="标本绑定" name="daiBangDing" v-if="loginInfo.zhanDian == '护士站'">
            <BiaoBenBangDing ref="bandDingRef" />
          </el-tab-pane>
          <el-tab-pane label="标本采集" name="yiBangDing" v-if="loginInfo.zhanDian == '护士站'">
            <BiaoBenCaiJi ref="caiJiRef" />
          </el-tab-pane>
          <el-tab-pane label="标本送出" name="yiCaiJi" v-if="loginInfo.zhanDian == '护士站'">
            <BiaoBenSongChu ref="songChuRef" />
          </el-tab-pane>
          <el-tab-pane label="标本送达" name="yiSongChu" v-if="loginInfo.zhanDian == '输血科'">
            <BiaoBenSongDa ref="songDaRef" />
          </el-tab-pane>
          <el-tab-pane label="标本接收" name="yiSongDa" v-if="loginInfo.zhanDian == '输血科'">
            <BiaoBenJieShou ref="jieShouRef" />
          </el-tab-pane>
        </el-tabs>
      </template>
    </MkDragSplitPanel>
  </div>
</template>

<script lang='ts' setup name="biaoBenGuanLi">
import { TabsPaneContext } from 'element-plus'
import BiaoBenBangDing from '/@/views/spe/biaoBenBangDing/index.vue'
import BiaoBenCaiJi from '/@/views/spe/biaoBenCaiJi/index.vue'
import BiaoBenSongChu from '/@/views/spe/biaoBenSongChu/index.vue'
import BiaoBenSongDa from '/@/views/spe/biaoBenSongDa/index.vue'
import BiaoBenJieShou from '/@/views/spe/biaoBenJieShou/index.vue'
import { loginInfo } from '/@/stores/baseInfo'

const listShenQingRef = ref()
const tabActivieName = ref('daiBangDing')
const tabChange = (pane: TabsPaneContext, ev: Event) => {
  listShenQingRef.value?.changeZhuangTai(pane.paneName) 
}
onMounted(() => {
  console.log(loginInfo.value);
  if (loginInfo.value.zhanDian == '输血科') {
    tabActivieName.value = 'yiSongChu'
  }
  listShenQingRef.value?.changeZhuangTai(tabActivieName.value)
})

const bandDingRef = ref()
const caiJiRef = ref()
const songChuRef = ref()
const songDaRef = ref()
const jieShouRef = ref()
const listDblclick = (row: any) => {
  if (tabActivieName.value == 'daiBangDing') {
    bandDingRef.value?.getByRow(row)
  } else if (tabActivieName.value == 'yiBangDing') {
    caiJiRef.value?.getByRow(row)
  } else if (tabActivieName.value == 'yiCaiJi') {
    songChuRef.value?.getByRow(row)
  } else if (tabActivieName.value == 'yiSongChu') {
    songDaRef.value?.getByRow(row)
  } else if (tabActivieName.value == 'yiSongDa') {
    jieShouRef.value?.getByRow(row)
  }
}
</script>

<style lang='scss' scoped>
:deep(.el-tabs__content) {
  overflow: auto;
} 
</style>